<table border="1">
<tr><td colspan="6" align="center">GAMES:</td></tr>
<% @games.each do |game|%>
<tr>
	<td>
		<%=game.id%>
	</td>
	<td>
		<table border="1" width="100%" style="text-align: center">
		<tr>
			<td>&nbsp;</td>
			<td bgcolor="<%= game.north.nil? || game.north.id != game.active_player_id ? "#FFFFFF" : "#00FF00" %>"><%= game.north.nil? ? (link_to "Join", join_path(game.id,1, 0)) : (link_to game.north.name, join_path(game.id, 1, game.north.id))%></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td bgcolor="<%= game.west.nil? || game.west.id != game.active_player_id ? "#FFFFFF" : "#00FF00" %>"><%= game.west.nil? ? (link_to "Join", join_path(game.id,4, 0)) : (link_to game.west.name, join_path(game.id, 1, game.west.id))%></td>
			<td>&nbsp;</td>
			<td bgcolor="<%= game.east.nil? || game.east.id != game.active_player_id ? "#FFFFFF" : "#00FF00" %>"><%= game.east.nil? ? (link_to "Join", join_path(game.id,3, 0)) : (link_to game.east.name, join_path(game.id, 1, game.east.id))%></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td bgcolor="<%= game.south.nil? || game.south.id != game.active_player_id ? "#FFFFFF" : "#00FF00" %>"><%= game.south.nil? ? (link_to "Join", join_path(game.id,2, 0)) : (link_to game.south.name, join_path(game.id, 1, game.south.id))%></td>
			<td>&nbsp;</td>
		</tr>
		</table>
	</td>
<td><%=link_to "Spectate", game_path(game.id) %>
</tr>
<%end%>
<tr><td colspan="3" align="center"><%=link_to "New Game", new_game_path%></td></tr>
</table>
